#!/bin/sh

#this scripts is used for LTE dail with qmi
#note1: the module must be init before any other usb 3g/4g dongle
#note2: we only support 4g LTE dail,don't support 4g dongle, interface wwan0 is always think as 4G currently when dail with qmi

ACTION=$1
script=
#logfile=/tmp/4glog
logfile=/dev/console

dail()
{
	shell_script=$1
	shell_action=$2

	killall ${shell_script}
	${shell_script} ${shell_action} &
}

	echo "4g start" > $logfile
	#1.check pid vid
	LTE_PID=`cat /sys/bus/usb/devices/1-1.1/idProduct`
	LTE_VID=`cat /sys/bus/usb/devices/1-1.1/idVendor`

	#//SLM638B:
	#P:  Vendor=05c6 ProdID=9025 Rev= 2.32
	#I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=usbserial_generic
	#I:* If#= 4 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether

	if [ "${LTE_PID}" = "9025" -a "${LTE_VID}" = "05c6" ];then
		script=SLM630B.sh
		dail $script $ACTION
	else
		echo "this module is not support! ----> pid=[0x${LTE_PID}],vid=[0x{LTE_VID}]" >> $logfile
	fi